#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a[7];
	cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5];
	sort(a+1,a+6);
	long long mx=-0x3f3f3f3f;
	do
	{
		long long sum=(a[1]*100+a[2]*10+a[3])*(a[4]*10+a[5]);
		mx=sum>=mx?sum:mx;
	}while(next_permutation(a+1,a+6));
	cout<<mx;
    return 0;
}
